package com.cv.platform.dal.mapper.comment;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.mybatis.core.mapper.BaseMapperX;
import com.cv.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cv.platform.controller.platform.comment.vo.record.CvCommentReqVO;
import com.cv.platform.controller.platform.comment.vo.record.CvCommentRespVO;
import com.cv.platform.dal.dataobject.comment.CvCommentDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 视频评论数据层
 *
 * @author Charles_XDXD
 */
@Mapper
public interface CvCommentMapper extends BaseMapperX<CvCommentDO> {
    default PageResult<CvCommentRespVO> selectPage(CvCommentReqVO reqVO) {
        return selectJoinPage(reqVO, CvCommentRespVO.class, new MPJLambdaWrapperX<CvCommentDO>()
                .selectAll(CvCommentDO.class)
                .eq(CvCommentDO::getVideoId, reqVO.getVideoId())
                .orderByDesc(CvCommentDO::getCreateTime)
        );
    }
    
}
